import axios from "axios";
let service = axios.create({
  baseURL: "http://localhost:8888/api", //process.env.VUE_APP_BASE_API
  timeout: 5000,
});
//请求拦截器
service.interceptors.request.use(
  (config) => {
    //获取token
    // const token = localStorage.getItem("token");
    // if (token) {
    //   config.headers.authorization = token;
    // }
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);

//响应拦截器;
service.interceptors.response.use(
  (response) => {
    return response.data;
  },
  (error) => {
    return Promise.reject(error);
  }
);
export default service;
